// import 'package:flutter/material.dart';
//样式统一 IOS风格
import "package:flutter/cupertino.dart";
import 'package:untitled2/pages/Search.dart';
import 'package:untitled2/pages/class/ClassType.dart';
import 'package:untitled2/pages/class/OneClass.dart';
import 'package:untitled2/pages/class/ThreeClass.dart';
import 'package:untitled2/pages/class/TwoClass.dart';
import 'package:untitled2/pages/device/DeviceInfo.dart';
import 'package:untitled2/pages/home/HomePage.dart';
import 'package:untitled2/pages/jump/JumpApp.dart';
import 'package:untitled2/pages/location/GaoDeLocation.dart';
import 'package:untitled2/pages/msg/Message.dart';
import 'package:untitled2/pages/my/MyUser.dart';
import 'package:untitled2/pages/news/News.dart';
import 'package:untitled2/pages/news/NewsContent.dart';
import 'package:untitled2/pages/page/pageBanner.dart';
import 'package:untitled2/pages/page/pageViewFullPage.dart';
import 'package:untitled2/pages/scanner/MobileScanner.dart';
import 'package:untitled2/pages/tab/TabBar.dart';
import 'package:untitled2/pages/time/DatePicker.dart';
import 'package:untitled2/pages/up_data_app/UpDataApp.dart';
import 'package:untitled2/pages/video/VideoPlay.dart';

Map routes = {
  "/search": (context, {arguments}) => Search(
        arguments: arguments,
      ),
  "/home": (context) => HomePage(),
  "/classType": (context) => ClassType(),
  "/my": (context) => MyUser(),
  "/message": (context) => MessagePage(),
  "/tabBar": (context) => TabBarDemo(),
  "/oneClass": (context) => OneClass(),
  "/twoClass": (context) => TwoClass(),
  "/threeClass": (context) => ThreeClass(),
  "/douyin": (context) => PageViewFullPage(),
  "/banner": (context) => pageBanner(),
  "/datePicker": (context) => DatePicker(),
  "/News": (context) => News(),
  "/NewsContent": (context, {arguments}) => NewsContent(arguments: arguments),
  "/DeviceInfo": (context) => DeviceInfo(),
  "/GaodeLocation": (context) => GaodeLocation(),
  "/VideoPlay": (context) => VideoPlay(),
  "/MobileScanner": (context) => MobileScanner(),
  "/UpDataApp": (context) => UpDataApp(),
  "/JumpApp": (context) => JumpApp(),
};

var onGenerateRoute = (RouteSettings settings) {
  final String? name = settings.name; //  /news 或者 /search
  final Function? pageContentBuilder = routes[name]; //  Function = (contxt) { return const NewsPage()}

  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = CupertinoPageRoute(builder: (context) => pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route = CupertinoPageRoute(builder: (context) => pageContentBuilder(context));

      return route;
    }
  }
  return null;
};
